package com.hhh.petadopt.serviceImpl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hhh.petadopt.mapper.SentPMapper;
import com.hhh.petadopt.pojo.Sentp;
import com.hhh.petadopt.service.SentpService;
import com.hhh.petadopt.utils.IDUtils;
/**
 * 送养处理
 * @author 杜镇声声
 *
 */
@Service
public class SentpServiceImpl implements SentpService {
	
	@Autowired
	private SentPMapper sentpMapper;

	//送养信息入库
	@Override
	public void saveSentPet(Sentp sentp) {
		//补全信息
		//id
		long ids = IDUtils.genItemId();
		String id = String.valueOf(ids).substring(6);
		sentp.setId(Long.valueOf(id));
		//设置时间
		sentp.setCreatedd(new Date());
		sentp.setUpdated(new Date());
		//将信息入库
		sentpMapper.savepett(sentp);
		//将送养描述入库
		sentpMapper.saveSentDesc(sentp);

	}

}
